#ifndef PKW_H
#define PKW_H

#include "Automobile.h"
#include "WheelSpinSensor.h"

//! Represents a PKW which is a specialisation of an Automobile.
/*!
The class PKW represents a PKW which is derived by Automobile.
A PKW currently has a Speedometer and an Odometer. 
In terms of Design patterns, a PKW is a concrete subject which
holds data about the speed the PKW is going.
\class PKW
\author Thomas Pfeiffer
\date 13.11.2012
*/
class PKW : public Automobile {
public:

	//! The CTor of the PKW
	/*!
	Constructs the PKW and sets the wheel diameter.
	\param wheel_diameter The wheel diamter of the PKW in mm.
	\param sens The WheelSpinSensor which feeds the PKW with
	Wheel Revolution Data. sens is automatically freed when the PKW is 
	being destroyed. If sense is an invalid pointer (0) then the PKW
	uses 0 as its revolutions anytime process() is called.
	*/
	PKW(size_t wheel_diameter, WheelSpinSensor * sens);

	//! DTor of the PKW
	/*!
	The destructor of the PKW frees the memory which is allocated
	by its WheelSpinSensor.
	*/
	~PKW() { delete mSensor; }

	//! Update the current speed
	/*!
	Reads the data from the Wheel spin sensor 
	and stores the current revolutions returned by the sensor.
	Notify is called which causes all observers to update
	their data.
	*/
	void Process();

	//! Returns the current speed of the car.
	/*!
	The function GetCurrentSpeed() calculates the speed
	of the car by using the Diameter and the revolutions.
	The formula for the calculations is:
	(revolutions / 60) x diameter/1000 x PI x 3.6 = speed km/h
	\returns the last calculated speed of the PKW.
	*/
	double GetCurrentSpeed() const;

private:
	size_t mDiameter;
	size_t mRevolutions;

	WheelSpinSensor *mSensor;
};

#endif